import  com.lucastex.grails.fileuploader.UFile

class Courseware {
    String title
    String content
    School school
  
    Categorys category 
    Teacher editor
    Teacher lastEditor
    Date createTime = new Date();
    Date lastTime = new Date();

    Boolean vip = false // vip才能查看
    Integer value = 0 // 查看需要的积分
    Integer hit = 0 //
    static hasMany = [ attachments : UFile ]



    static mapping = {
       table 'xedu_courseware'
  
       sort  createTime : 'desc'
    }

    static constraints = {
        title(size:1..250,blank:false)
        category()
        content(size:0..10000,blank:false)
        attachments()
        vip()
        value(blank:true)
        editor(nullable: true)
        lastEditor(nullable: true)
        hit(blank:true)
        school()
        
    }

    String toString() {
        "${title}"
    } 
}
